package com.itheima.utils;
//ThreadLocal：线程变量，每个线程都拥有自己的变量副本，线程之间互不干扰
//定义ThreadLocal操作的工具类，用于操作当前登录员工id
public class UserContext {
    private static ThreadLocal<Integer> tl = new ThreadLocal<>();

    public static void setCurrentEmpId(Integer empId) {
        tl.set(empId);
    }
    public static Integer getCurrentEmpId() {
        return tl.get();
    }

    public static void remove() {
        tl.remove();
    }

}
